package com.armed.client.interfaz.finder;

import com.armed.searchs.AbstractFilter;
import com.armed.searchs.IntegerFilter;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * Class AbstractFilterTableRenderer
 *
 *
 * @author init() software
 * @version 07/03/2008 
 */
public class AbstractFilterTableRenderer extends DefaultTableCellRenderer
{
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,boolean isSelected, boolean hasFocus, int row, int column) 
    {
        Component component = super.getTableCellRendererComponent(table, value,isSelected, hasFocus, row, column);
        if (value == null)
            ((JLabel) component).setText("");
        if (value instanceof AbstractFilter)
        {
            AbstractFilter fil = (AbstractFilter)value;
            ((JLabel) component).setText(fil.toString());
            ((JLabel) component).setHorizontalAlignment(JLabel.CENTER);
            return component;            
        }
        return component;
    }
}
